//
//  Binding_MobilePhoneViewController.m
//  fxxiaoke
//
//  Created by 鞠超 on 16/9/9.
//  Copyright © 2016年 jc. All rights reserved.
//

#import "Binding_MobilePhoneViewController.h"

#import "ChangeTelViewController.h"

@interface Binding_MobilePhoneViewController () <UIScrollViewDelegate>

@property (nonatomic, strong) UIScrollView * scrollView;
//
@property (nonatomic, strong) UILabel * telNumber;

@end

@implementation Binding_MobilePhoneViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self p_navi];
    
    [self p_setupView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - navi
- (void )p_navi
{
    _btnLeft.hidden = YES;
    _lblLeft.hidden = YES;
    _btnRight.hidden = YES;
    _lblRight.hidden = YES;
    
    _lblTitle.text = @"绑定手机号";
    
    //左返回
    UIImageView * image_LeftRetrun = [[UIImageView alloc] initWithFrame:CGRectMake(11, 31.5, 25, 25)];
    image_LeftRetrun.userInteractionEnabled = YES;
    image_LeftRetrun.image = [UIImage imageNamed:@"Left-return.png"];
    [_topView addSubview:image_LeftRetrun];
    
    UILabel * lbl_return = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(image_LeftRetrun.frame) - 6, 35, 70, 15)];
    lbl_return.text = @"编辑资料";
    lbl_return.textColor = [UIColor whiteColor];
    lbl_return.font = [UIFont systemFontOfSize:17];
    [_topView addSubview:lbl_return];
    
    UIButton * btn_return = [UIButton buttonWithType:(UIButtonTypeSystem)];
    btn_return.frame = CGRectMake(10, 22, 90, 40);
    [_topView addSubview:btn_return];
    [btn_return addTarget:self action:@selector(btn_returnAction:) forControlEvents:(UIControlEventTouchUpInside)];
}

//左返回
- (void )btn_returnAction:(UIButton *)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}

//tabbar
- (void )viewWillAppear:(BOOL)animated
{
    [(AppDelegate *)[[UIApplication sharedApplication] delegate] hiddenTabBar];
}

#pragma mark - 布局
- (void )p_setupView
{
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, SCREEN_HEIGHT - 64)];
    self.scrollView.backgroundColor = [UIColor whiteColor];
    self.scrollView.showsVerticalScrollIndicator = NO;
    self.scrollView.contentSize = CGSizeMake(0, SCREEN_HEIGHT - 60);
    self.scrollView.delegate = self;
    [self.view addSubview:self.scrollView];
    
    //
    UIImageView * image_Pic = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 2 - 50, 40, 100, 100)];
    image_Pic.layer.cornerRadius = 50;
    image_Pic.layer.masksToBounds = YES;
    image_Pic.image = [UIImage imageNamed:@"MobilePhone.png"];
    [self.scrollView addSubview:image_Pic];
    
    //
    UILabel * lbl_tel = [[UILabel alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(image_Pic.frame) + 25, SCREEN_WIDTH - 20, 20)];
    lbl_tel.text = @"当前手机号";
    lbl_tel.textColor = [UIColor blackColor];
    lbl_tel.font = [UIFont systemFontOfSize:17];
    lbl_tel.textAlignment = NSTextAlignmentCenter;
    [self.scrollView addSubview:lbl_tel];
    
    //
    self.telNumber = [[UILabel alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(lbl_tel.frame) + 10, SCREEN_WIDTH - 20, 20)];
    self.telNumber.text = @"1866999XXXX";
    self.telNumber.textColor = [UIColor blackColor];
    self.telNumber.font = [UIFont systemFontOfSize:17];
    self.telNumber.textAlignment = NSTextAlignmentCenter;
    [self.scrollView addSubview:self.telNumber];
    
    //
    UILabel * lbl_Introduct = [[UILabel alloc] initWithFrame:CGRectMake(15, CGRectGetMaxY(self.telNumber.frame) + 30, SCREEN_WIDTH - 30, 40)];
    lbl_Introduct.text = @"更换手机号，下次可使用新手机号登录。并会更新企业通讯录的号码信息";
    lbl_Introduct.textColor = [UIColor grayColor];
    lbl_Introduct.font = [UIFont systemFontOfSize:13];
    lbl_Introduct.textAlignment = NSTextAlignmentCenter;
    lbl_Introduct.numberOfLines = 2;
    [self.scrollView addSubview:lbl_Introduct];
    
    // 45 150 248
    UIButton * btn_changeTel = [UIButton buttonWithType:(UIButtonTypeSystem)];
    btn_changeTel.frame = CGRectMake(15, CGRectGetMaxY(lbl_Introduct.frame) + 20, SCREEN_WIDTH - 30, 40);
    btn_changeTel.layer.cornerRadius = 5;
    [btn_changeTel setTitle:@"更换手机号" forState:(UIControlStateNormal)];
    [btn_changeTel setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
    btn_changeTel.titleLabel.font = [UIFont systemFontOfSize:17.0f];
    btn_changeTel.backgroundColor = [UIColor colorWithRed:45/255.0 green:150/255.0 blue:248/255.0 alpha:1.0f];
    [self.scrollView addSubview:btn_changeTel];
    [btn_changeTel addTarget:self action:@selector(btn_changeTelAction:) forControlEvents:(UIControlEventTouchUpInside)];
}

#pragma mark - 点击更换手机号
- (void )btn_changeTelAction:(UIButton *)sender
{
//    NSLog(@"点击进入更换手机号");
    ChangeTelViewController * changeTelViewController = [[ChangeTelViewController alloc] init];
    [self showViewController:changeTelViewController sender:nil];
}







@end
